Release 10.1A: OpenEdge Development:
Progress 4GL Reference
SUBSTITUTE function
This function returns a character string that is made up of a base string plus the substitution of arguments in the string. It allows you to use a single string in place of concatenated strings. It is designed to simplify the task of translating an application from one language to another. This function is similar to the
sprintffunction of the C programming language.Syntax
base-stringA character string optionally containing substitution parameters of the form &
n, wherenis an integer between 1 and 9, inclusive.argA constant, field name, variable, or expression that results in a character string value. These argument values replace substitution parameters in
Examplesbase-string.These statements display the same message:
You can alter the position of the substitution parameters, as in this statement.
Notes
- The SUBSTITUTE function is double-byte enabled. The specified
base-stringandargvalues can contain double-byte characters.- To include an ampersand character in
base-string, enter two ampersands (&&).- The character following the ampersand character must be a digit, or Progress returns a run-time error.
- To display the result of the SUBSTITUTE function in a frame, you must specify FORMAT or accept the default format of X(8).
- If you use a substitution parameter in
base stringbut do not specify a corresponding argument, Progress replaces the substitution parameter with an empty string.- Any substitution parameter can appear multiple times in
base string. For example:
The code above displays the following line:
See also
|
Copyright © 2005 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |